package com.szrt.oa.role.service.impl;
/*package com.szrt.oa.user.service.impl;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.szrt.oa.base.DBUtil;
import com.szrt.oa.menu.dao.MenuDao;
import com.szrt.oa.menu.dao.impl.MenuDaoImpl;
import com.szrt.oa.menu.entity.MenuEntity;
import com.szrt.oa.user.dao.UserDao;
import com.szrt.oa.user.dao.impl.UserDaoImpl;
import com.szrt.oa.user.entity.UserEntity;
import com.szrt.oa.user.service.UserService;

public class UserServiceImpl implements UserService {

	private UserDao userDao=new UserDaoImpl();
	private MenuDao menuDao=new MenuDaoImpl();
	private Connection conn;
	
	@Override
	public Map<String, Object> findMenuByid(UserEntity entity) {
		
		Map<String, Object> map=new HashMap<String, Object>();
		try {
			//获得数据库链接，保证只有一个连接
			conn=DBUtil.getConn();
			//开启事务
			conn.setAutoCommit(false);
			
			String phone=entity.getPhone();
			UserEntity userEntity = userDao.findById(phone, conn);
			
			int id=userEntity.getId();
			
			List<MenuEntity> list = menuDao.findMenuByUserId(id, conn);
			
			map.put("list", list);
			map.put("code", "200");
			conn.commit();
			
		} catch (Exception e) {
			try {
				conn.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
			
			map.put("list", "null");
			map.put("code", "333");
			
			e.printStackTrace();
		}
		
		
		
		return map;
	}

}
*/